import request from '@/router/axios';

//apqp设计列表
export const getAPQPList = (params) => {
  return request({
    url: '/api/hg-public/apqpdesign/list',
    method: 'get',
    params: {
      ...params,
    }
  })
}

// 提交APQP
export const submitApqp = (params) => {
  return request({
    url: '/api/hg-public/apqpdesignlist/start-process',
    method: 'get',
    params: {
      ...params,
    }
  })
}
// 项目APQP设计提交状态
export const getProjectApqpStatus = (params) => {
  return request({
    url: '/api/hg-public/apqpdesign/getApqpStatus',
    method: 'get',
    params: {
      ...params,
    }
  })
}
//计划执行状态数量
export const getCarryonCount = (params) => {
  return request({
    url: '/api/hg-public/apqpdesign/getcount',
    method: 'get',
    params: {
      ...params,
    }
  })
}
//获取项目阶段下拉选
export const getStageList = (params) => {
  return request({
    url: '/api/hg-public/apqpdesign/getTaskPhases',
    method: 'get',
    params: {
      ...params,
    }
  })
}

//新增
export const addAPQP = (row) => {
  return request({
    url: '/api/hg-public/apqpdesign/save',
    method: 'post',
    data: row
  })
}

//删除 
export const removeAPQP = (ids) => {
  return request({
    url: '/api/hg-public/apqpdesign/remove',
    method: 'post',
    params: {
      ids,
    }
  })
}

//更新 
export const updateAPQP = (row) => {
  return request({
    url: '/api/hg-public/apqpdesign/update',
    method: 'post',
    data: row
  })
}

//获取 详情
export const getAPQP = (id) => {
  return request({
    url: '/api/hg-public/apqpdesign/detail',
    method: 'get',
    params: {
      id,
    }
  })
}

//获取部门
export const getDept = () => {
  return request({
    url: '/api/hg-public/personinfo/deptlist',
    method: 'get',
    params: {
    }
  })
}

// 获取任务提交物模板文件列表
export const getSubmitTemplate = (taskId) => {
  return request({
    url: '/api/hg-public/apqpdesign/getSubmission',
    method: 'get',
    params: {
      taskId
    }
  })
}
// 启动任务
export const startTask = (id) => {
  return request({
    url: '/api/hg-public/apqpdesign/taskStart',
    method: 'get',
    params: {
      id
    }
  })
}
// 提交任务
export const submitTask = (taskId) => {
  return request({
    url: '/api/hg-public/apqpdesign/start-process',
    method: 'get',
    params: {
      taskId
    }
  })
}

//上传提交物后 改变提交物状态
export const changeFileStatus = (params) => {
  return request({
    url: '/api/hg-public/apqpdesign/updateDetailStatus',
    method: 'get',
    params: {
      ...params
    }
  })
}

// 完成任务
export const finishTask = (id) => {
  return request({
    url: '/api/hg-public/apqpdesign/taskFinish',
    method: 'get',
    params: {
      id
    }
  })
}

// 获取甘特图-任务
export const getGanttTasks = (params) => {
  return request({
    url: '/api/hg-public/apqpdesign/ganttChartTask',
    method: 'get',
    params: {
      ...params
    }
  })
}

// 获取甘特图-进度
export const getProgressGantt = (params) => {
  return request({
    url: '/api/hg-public/apqpdesign/ganttChartSchedule',
    method: 'get',
    params: {
      ...params
    }
  })
}

//获取项目变更记录list
export const getProChangeList = (params) => {
  return request({
    url: '/api/hg-public/apqpdesign/getChangeList',
    method: 'get',
    params: {
      ...params,
    }
  })
}

//确认项目变更
export const confirmChange = (changeListId) => {
  return request({
    url: '/api/hg-public/apqpdesign/changeConfirm',
    method: 'post',
    params: {
      changeListId
    }
  })
}